//
//  MWGoodsDetailsAttrHeaderView.m
//  XiRan-iOS
//
//  Created by liuyiming on 2019/12/26.
//  Copyright © 2019 Wood. All rights reserved.
//

#import "MWGoodsDetailsAttrHeaderView.h"

@interface MWGoodsDetailsAttrHeaderView ()

@property(nonatomic, strong) UIView *dividerView;
@property(nonatomic, strong) UIView *containerView;
@property(nonatomic, strong) UIImageView *markIV;
@property(nonatomic, strong) UILabel *titleLB;

@end

@implementation MWGoodsDetailsAttrHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        [self setupPageSubviews];
    }
    
    return self;
}

- (void)setTitle:(NSString *)title {
    _titleLB.text = title;
}

- (void)setupPageSubviews {
    _dividerView = [[UIView alloc] init];
    _dividerView.backgroundColor = MWHexColor(@"#F6F7FB");
    [self.contentView addSubview:_dividerView];
    
    _containerView = [[UIView alloc] init];
    _containerView.backgroundColor = MWHexColor(@"#FFFFFF");
    [self.contentView addSubview:_containerView];
    
    _markIV = [[UIImageView alloc] init];
    _markIV.image = [UIImage imageNamed:@"ic_mark"];
    [_containerView addSubview:_markIV];
    
    _titleLB = [[UILabel alloc] init];
    _titleLB.font = MWFont(16);
    _titleLB.textColor = MWHexColor(@"#333333");
    [_containerView addSubview:_titleLB];
    
    [_dividerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.contentView);
        make.height.equalTo(@10);
    }];
    
    [_containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.dividerView.mas_bottom);
        make.left.right.equalTo(self);
        make.bottom.equalTo(self.contentView);
    }];
    
    [_markIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.containerView).offset(16);
        make.centerY.equalTo(self.containerView);
    }];
    
    [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.markIV.mas_right).offset(16);
        make.centerY.equalTo(self.containerView);
    }];
}

@end
